package main

import "fmt"

type Singleton struct{}

var instance *Singleton

func GetInstance() *Singleton {
	if instance == nil {
		instance = &Singleton{}
	}
	return instance
}

func main() {
	for i := 0; i < 10; i++ {
		go func() {
			fmt.Printf("%p\n", GetInstance())
		}()
	}
	fmt.Scanln() // 等待所有goroutine执行完毕
}
